<template>
	<view>
		<UserInfoCardVue></UserInfoCardVue>
		<view class="pad-16r">

			<ButtonVue content="在线反馈" @click="toPage"></ButtonVue>
			<view>
				<view v-for="(item,index) in dataSource" :key="index" class="data-item">
					<view class="border-col">{{item.createTime}}</view>
					<view class="data-item-title">
						<u-icon name="file-text" style="margin-right: 5px;"></u-icon>
						问题分类：{{item.typeName}} / {{item.questionName}}
					</view>
					<view class="start-center mar-10-0">
						<view class="over">
							<u-parse :html="item.feedBack"></u-parse>
						</view>
					</view>
					<view class="start-center" v-if="item.answer">
						<view class="answer line-height-20">
							<u-parse :html="item.answer"></u-parse>
							<view class="line-height-35">{{item.answerTime}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import UserInfoCardVue from '../../components/UserInfo/UserInfoCard.vue';
	import ButtonVue from '../../components/Button/Button.vue';
	import {
		mapGetters
	} from 'vuex';
	import {
		feedBackSelect
	} from '../../api/feedBack';
	export default {
		components: {
			UserInfoCardVue,
			ButtonVue
		},
		computed: {
			...mapGetters(['userInfo', "hostApi"]),
		},
		data() {
			return {
				dataSource: []
			}
		},
		mounted() {
			this.init()
		},
		methods: {
			init() {
				if (!this.userInfo) {
					this.$u.toast('请选择就诊卡')
					return;
				}
				feedBackSelect({
					patId: this.userInfo.patId,
					status: 1,
					orderBy: "answer_time desc,create_time desc"
				}).then(res => {
					console.log(res)
					this.dataSource = res
				})
			},
			toPage() {
				uni.navigateTo({
					url: '/pages/Feedback/Feedback'
				})
			}
		}
	}
</script>

<style scoped>
	.data-item {
		background: transparent;
		padding: 18rpx 16rpx;
		display: flex;
		flex-direction: column;
		box-shadow: 0 5px 1000px 1rpx #e0e2e7;
		margin: 16rpx 0;
		border-radius: 10px;
		background-color: white;

		.data-item-title {
			font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
			font-weight: 400;
			font-size: 14px;
			color: #999999;
			line-height: 25px;
			text-align: left;
			font-style: normal;
			text-transform: none;
			margin-right: 10px;
		}

		.answer {
			background-color: rgb(229, 239, 238);
			border-radius: 16rpx;
			padding: 16rpx;
			width: 100%;
			color: rgb(134, 134, 134);
		}
	}
</style>